﻿using Pb;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EginUser  {

    private static EginUser _instance;
    public static EginUser Instance
    {
        get
        {
            if (_instance == null)
            {
                _instance = new EginUser();
            }
            return _instance;
        }
    }

    #region  用户信息
    public string Uid;
    public string nickname;
    public bool isModifyAvatar;
    public int loginControl;//登陆方式    
    public int avatarId { get; set; }
    public string coinCount;
    public int bankCoinCount;
    public string userUrl;
    public string IP;
    public SEX sex;
    public UISprite usersprit;
    #endregion
    public List<GameRollNoticeItem> NoticePb = new List<GameRollNoticeItem>();
    public bool haveNotice;
    public bool isAgent;//是不是代理
    public int agentUid;//代理Uid
    public int branchCount;//下级玩家数量
    //public string realName;//真实姓名
    //public string alipay;//支付宝账号

    public int roomCardCount;
    public int roomId;
    //存储所有用户信息
    public List<GameUserInfo> gameUserInfoList=new  List<GameUserInfo>();
    public List<GameUserInfo> tempGameUserInfoList = new List<GameUserInfo>();
  
    //客服微信
    public string serviceWeixin;
    //该领取第几次的签到奖励
    public int SignTimes;
    //房间信息
    public List<RoomTypeInfo> nnRoomList;
    public List<RoomTypeInfo> mahjongRoomList;
    public List<RoomTypeInfo> ddzRoomList;
    public List<RoomTypeInfo> pdkRoomList;
    public List<RoomTypeInfo> xtjRoomList;  

    //重连次数
    public int RecentTimes;
    public UserKickOutMessage userKickOutMessage;
    //LOG提示
    public string logMsg { get; set; }


    //控制好友场金币场 好友场为1 金币场为2
    public int ControlScene;
    //控制游戏类型 房间类型 1，2，3，4，0 分别对应游戏：麻将、牛牛、斗地主、炸金花
    public int gameType { get; set; }

    public int musicControl;

    //音乐状态
    public bool bgMusic = true;
    public bool effectMusic = true;

 
    //加入用户信息
    public List<PaiPlayer> paijiuUserInfoList = new List<PaiPlayer>();
    public List<PaiPlayer> paijiiuChonglianInf = new List<PaiPlayer>();

    public string ReturnRelCoin(int tempCoin)
    {
        int tempCoinCount = tempCoin;
        string str = ((float)tempCoinCount / (float)100).ToString("0.00");
        //Debug.Log(str);
        return str;
    }

    public string ReturnRelCoinForRoom(int tempCoin)
    {
        int tempCoinCount = tempCoin;
        string str = ((float)tempCoinCount / (float)100).ToString("0");
        //Debug.Log(str);
        return str;
    }

    public string ReturnRelCoinForBrief(int tempCoin)
    {
        float tempCoinCount = 0;
        int coin = tempCoin;
        string tempStr = "";
        if (Mathf.Abs(coin) < 10000)
        {
            tempStr = coin.ToString();           
        }
        else if (Mathf.Abs(coin) >= 10000)
        {
            int tempScore = Mathf.Abs(coin);
            tempStr = tempScore / 10000 + ((((float)(tempScore % 10000) / (float)10000)).ToString()).Remove(0, 1) + "万";                      
        }        
        return tempStr;
    }


    public string ReturnMoney(int tempCoin)
    {
        float tempCoinCount = 0;
        int coin = tempCoin;
        string tempStr = "";
        if (Mathf.Abs(coin) < 10000)
        {
            tempStr = coin.ToString();
        }
        else if (Mathf.Abs(coin) >= 10000 && Mathf.Abs(coin) < 100000000)
        {
            int tempScore = coin;
            tempStr = tempScore / 10000 + ((((float)(tempScore % 10000) / (float)10000)).ToString("0.00")).Remove(0, 1);
            tempCoinCount = float.Parse(tempStr);
            tempStr = tempCoinCount.ToString("0.00") + "万";
        }
        else if (Mathf.Abs(coin) >= 100000000)
        {
            int tempScore = coin;
            tempStr = tempScore / 100000000 + ((((float)(tempScore % 100000000) / (float)100000000)).ToString("0.00")).Remove(0, 1);
            tempCoinCount = float.Parse(tempStr);
            tempStr = tempCoinCount.ToString("0.00") + "亿";
        }

        return tempStr;
    }


    public string ReturnMoneyForLong(long tempCoin)
    {
        float tempCoinCount = 0;
        long coin = tempCoin;
        string tempStr = "";
        if (Mathf.Abs(coin) < 10000)
        {
            tempStr = coin.ToString();
        }
        else if (Mathf.Abs(coin) >= 10000 && Mathf.Abs(coin) < 100000000)
        {
            long tempScore = coin;
            tempStr = tempScore / 10000 + ((((float)(tempScore % 10000) / (float)10000)).ToString("0.00")).Remove(0, 1);
            tempCoinCount = float.Parse(tempStr);
            tempStr = tempCoinCount.ToString("0.00") + "万";
        }
        else if (Mathf.Abs(coin) >= 100000000)
        {           
            long tempScore = coin;
            tempStr = tempScore / 100000000 + ((((float)(tempScore % 100000000) / (float)100000000)).ToString("0.00")).Remove(0, 1);
            tempCoinCount = float.Parse(tempStr);
            tempStr = tempCoinCount.ToString("0.00") + "亿";
        }

        return tempStr;
    }
}
